#include<stdio.h>
int main()
{
    float price = 0;
    int m, d;
    int flag = 0;

    scanf_s("%f %d %d %d", &price, &m, &d, &flag);

    if (m == 11 && d == 11)
        price =(float)( 0.7 * price - (double) flag * 50);

    else if (m == 12 && d == 12)
        price =(float) ( 0.8 * price - (double)flag * 50);

    if (price < 0)
        printf("0.00");
    else
        printf("%.2f", price);

    int a = 4;
    long long b = 3;
    a = b;

    return 0;
}